<template>
  <div>
    <el-dialog v-model="dialogTableVisible" top="5vh">
      <el-scrollbar height="650px">
        <el-descriptions
          title="财务信息"
          direction="horizontat"
          :column="1"
          border
        >
          <el-descriptions-item label="所属项目">
            {{ detailData.projectName }}</el-descriptions-item
          >
          <el-descriptions-item label="财务类型">
            {{ detailData.financeType }}</el-descriptions-item
          >
          <el-descriptions-item label="金额">
            {{ detailData.financeTotal }}</el-descriptions-item
          >
          <el-descriptions-item label="发生时间">
            {{ detailData.accurrentTime }}</el-descriptions-item
          >
          <el-descriptions-item label="当前状态">
              <template v-if="detailData.currentStatus == '0'">提交</template>
              <template v-if="detailData.currentStatus == '1'">保存</template>
            </el-descriptions-item>
          <el-descriptions-item label="备注">
            {{ detailData.otherText }}</el-descriptions-item
          >
          <el-descriptions-item label="附件">
            {{ detailData.financeType }}</el-descriptions-item
          >
          <el-descriptions-item
            label="附件"
            v-if="detailData.files != null &&  detailData.files.length > 0"
          >
            <template v-for="data in detailData.files" :key="data.id">
              <a
                :href="
                  'http://101.43.150.171:8082/financeInfos/downLoad?fileName=' +
                  data.utilName +
                  '&fileNameSrc=' +
                  data.utilSrcName +
                  '&parameter=' +
                  token
                "
              >
                {{ data.utilSrcName }}
              </a>
              <br />
            </template>
          </el-descriptions-item>
        </el-descriptions>
      </el-scrollbar>
    </el-dialog>
  </div>
</template>
<script>
import axios from "../../utils/request";
export default {
  data() {
    return {
      detailData: {},
      dialogTableVisible: false,
    };
  },
  methods: {
    getFinanceFDetail(id) {
      axios.get("/financeInfos/detail", { params: { id: id } }).then((res) => {
        this.detailData = res.data.data.financeInfo;
        console.log(this.detailData);
      });
    },
    showDialog(id) {
      this.dialogTableVisible = true;
      this.getFinanceFDetail(id);
    },
  },
  computed: {
    token: {
      get() {
        return localStorage.getItem("token");
      },
    },
  },
};
</script>